<template>

<div class="background-image">
    <div class="loginVideo">

<div class="loginBox">
    <!-- 登录框 -->
    <div class="container">
        <div class="drop">
            <div class="content">
                <h2 :style="{ color: '#000fff' }">TMS物流管理信息系统</h2>
                <form @submit.prevent="degnlu">
                    <div class="inputBox">
                       <el-input v-model="infor.username" @keydown.enter="degnlu"  style="width: 240px" />
                    </div>
                    <div class="inputBox">
                        <el-input v-model="infor.password" type="password" @keydown.enter="degnlu"  show-password style="width: 240px" />
                    </div>
                    <div class="inputBox" :style="{ margin: '0 auto' }">
                     <input :style="{ color: 'white' }" type="button" value="登录" @click="degnlu" />
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
</div>

  </div>



   






</template>

<script setup>
import { onMounted, ref, reactive } from "vue";
import { useRouter } from "vue-router";
import axios from 'axios'
const router = useRouter();
import { ElMessage } from 'element-plus'
const infor = reactive({
    username: "",
    password: ""
})


// 登录
function degnlu () {
  let login = {
    systemCode: '2bc5558f-dea4-4030-86bb-f08b64595af3',
    username: infor.username,
    password: infor.password
  }
  axios.post('http://1.117.93.87:8000/rbacdu/api/Login/Login', login).then(res => {
    console.log(res);
   
    axios.get('/hread/api/ContractRead/Getuname').then(res => {
      console.log(res.data);
      localStorage.setItem("username", res.data)
     
    })
   if (res.data.code == 200) {

      //ElMessage.success("登录成功")

      localStorage.Tokens = res.data.data;
      //console.log(localStorage.Tokens);

      //localStorage.username=infor.username
      router.push("RegisterBoard")
    }
    else {
      ElMessage.error("登录失败")
    }
  }).catch(err => {
    console.log(err);

  })

}
</script>

<style scoped>
/* html{
    height: 100%;
  }
  body{
    background-image: url(http://localhost:39483/Imgs/风景03.jpg);
  } */
    
  .background-image {
  /* 设置背景图片 */
  background-image: url('http://10.223.8.15:8000/hread/Pic/QQ20241204-090435.png');
  /* 确保背景图片覆盖整个元素 */
  background-size: cover;
  /* 背景图片固定，不随滚动条移动 */
  background-attachment: fixed;
  /* 背景图片居中 */
  background-position: center;
  /* 高度和宽度可以根据需要调整 */
  height: 100vh;
  width: 100%;
  /* 添加一些文本对齐和颜色样式 */
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  text-align: center;
}
   







.loginVideo {
    width: 100%;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* 验证码样式 */
.canvascs {
    width: 92px;
    height: 30px;
    border-radius: 5px;
    margin-top: 2px;
    background: white;
    margin-left: 5px;
}

#yanzheng {
    display: flex;
    width: 130px;
}

#yanzheng div {
    width: 96px;
    /* background: pink; */
}

#yanzheng input {
    width: 100px;
}

video {
    height: 100%;
    width: 100%;
    object-fit: cover;
    object-position: center;
}

.loginBox {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* 登录框 */
.container .drop {
    position: relative;
    width: 350px;
    height: 350px;
    box-shadow: inset 20px 20px 20px rgba(0, 0, 0, 0.05),
        25px 35px 20px rgba(0, 0, 0, 0.05), 25px 30px 30px rgba(0, 0, 0, 0.05),
        inset -20px -20px 25px rgba(255, 255, 255, 0.9);
    transition: 0.5s;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
}

.container .drop:hover {
    border-radius: 10%;
}

.container .drop::before {
    content: "";
    position: absolute;
    top: 50px;
    left: 85px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #fff;
    opacity: 0.9;
}

.container .drop::after {
    content: "";
    position: absolute;
    top: 90px;
    left: 110px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #fff;
    opacity: 0.9;
}

.container .drop .content {
    position: relative;
    display: flex;
    justify-content: center;
    /* align-items: center; */
    flex-direction: column;
    text-align: center;
    padding: 40px;
    gap: 15px;
}

.container .drop .content h2 {
    position: relative;
    color: #333;
    font-size: 1.5em;
}

.container .drop .content form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    justify-content: center;
    /* align-items: center; */
}

.container .drop .content form .inputBox {
    position: relative;
    width: 225px;
    box-shadow: inset 2px 5px 10px rgba(0, 0, 0, 0.1),
        inset -2px -5px 10px rgba(255, 255, 255, 1),
        15px 15px 10px rgba(0, 0, 0, 0.05), 15px 10px 15px rgba(0, 0, 0, 0.025);
    border-radius: 25px;
}

.container .drop .content form .inputBox::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 65%;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 5px;
}

.container .drop .content form .inputBox input {
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    font-size: 1em;
    padding: 10px 15px;
}

.container .drop .content form .inputBox input[type="submit"] {
    color: #fff;
    text-transform: uppercase;
    font-size: 1em;
    cursor: pointer;
    letter-spacing: 0.1em;
    font-weight: 500;
}

.container .drop .content form .inputBox:last-child {
    width: 120px;
    background: #3399ff;
    box-shadow: inset 2px 5px 10px rgba(0, 0, 0, 0.1),
        15px 15px 10px rgba(0, 0, 0, 0.05), 15px 10px 15px rgba(0, 0, 0, 0.025);
    transition: 0.5s;
}

.container .drop .content form .inputBox:last-child:hover {
    width: 150px;
}

.btns {
    position: absolute;
    right: -120px;
    bottom: 0;
    width: 120px;
    height: 120px;
    background: #00a6bc;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    text-decoration: none;
    color: #fff;
    line-height: 1.2em;
    letter-spacing: 0.1em;
    font-size: 0.8em;
    transition: 0.25s;
    text-align: center;
    box-shadow: inset 10px 10px 10px rgba(0, 166, 188, 0.05),
        15px 25px 10px rgba(0, 166, 188, 0.1), 15px 20px 20px rgba(0, 166, 188, 0.1),
        inset -10px -10px 15px rgba(0, 166, 188, 0.5);
    border-radius: 50%;
}

.btns::before {
    content: "";
    position: absolute;
    top: 15px;
    left: 30px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    opacity: 0.45;
}

.btns.signup {
    bottom: 150px;
    right: -120px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #00a6bc;
    box-shadow: inset 10px 10px 10px rgba(0, 166, 188, 0.05),
        15px 25px 10px rgba(0, 166, 188, 0.1), 15px 20px 20px rgba(0, 166, 188, 0.1),
        inset -10px -10px 15px rgba(0, 166, 188, 0.5);
}

.btns.signup::before {
    left: 20px;
    width: 15px;
    height: 15px;
}

.btns:hover {
    border-radius: 10%;
}

</style>
